package home_8_11;

import java.util.Scanner;

/**
 *
 有一个不多于5位的正整数，求它是几位数，分别打印出每一位数字。
 */
public class home11 {
    public static void main(String[] args) {
        System.out.println("请输入不多于5位的正整数");
        Scanner scan = new Scanner(System.in);
        int x=scan.nextInt();
        int y;

        if (x/10000!=0){
            System.out.println("五位数");
            System.out.println(x%10);
            for (int i=1;i<5;i++){
                 x=x/10;
                 y=x%10;
                System.out.print(y);
                System.out.println("");

            }

        }else if (x/1000!=0){
            System.out.println("四位数");
            System.out.println(x%10);
            for (int i=1;i<4;i++){
                x=x/10;
                y=x%10;
                System.out.print(y);
                System.out.println("");

            }

        }else  if (x/100!=0){
            System.out.println("三位数");
            System.out.println(x%10);
            for (int i=1;i<3;i++){
                x=x/10;
                y=x%10;
                System.out.print(y);
                System.out.println("");

            }

        } else   if (x/10!=0){
            System.out.println("两位数");
            System.out.println(x%10);
            for (int i=1;i<2;i++){
                x=x/10;
                y=x%10;
                System.out.print(y);
                System.out.println("");

            }

        }   else{
            System.out.println("一位数");
            System.out.println(x%10);
                y=x%10;


            }

        }
    }

